import { IPSSysBIAggTable } from './ipssys-biagg-table';
import { IPSSysBICube } from './ipssys-bicube';
import { IPSSysBIDimension } from './ipssys-bidimension';
import { IPSSysBIScheme } from './ipssys-bischeme';
import { IPSSysSFPlugin } from '../res/ipssys-sfplugin';
import { IPSSystemModule } from '../system/ipssystem-module';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSysBISchemeImpl extends PSModelObjectImpl implements IPSSysBIScheme {
  protected allpssysbiaggtables: IPSSysBIAggTable[] | null = null;

  getAllPSSysBIAggTables(): IPSSysBIAggTable[] | null {
    if (this.allpssysbiaggtables == null) {
      this.allpssysbiaggtables = this.fillChildListModel(this.M.getAllPSSysBIAggTables, 'bi.IPSSysBIAggTable') as IPSSysBIAggTable[];
    }
    return this.allpssysbiaggtables;
  }

  get allPSSysBIAggTables(): IPSSysBIAggTable[] | null {
    return this.getAllPSSysBIAggTables();
  }

  findPSSysBIAggTable(objKey: any): IPSSysBIAggTable | null {
    return this.getPSModel5('bi.IPSSysBIAggTable', this.getAllPSSysBIAggTables(), objKey) as IPSSysBIAggTable;
  }

  protected allpssysbicubes: IPSSysBICube[] | null = null;

  getAllPSSysBICubes(): IPSSysBICube[] | null {
    if (this.allpssysbicubes == null) {
      this.allpssysbicubes = this.fillChildListModel(this.M.getAllPSSysBICubes, 'bi.IPSSysBICube') as IPSSysBICube[];
    }
    return this.allpssysbicubes;
  }

  get allPSSysBICubes(): IPSSysBICube[] | null {
    return this.getAllPSSysBICubes();
  }

  findPSSysBICube(objKey: any): IPSSysBICube | null {
    return this.getPSModel5('bi.IPSSysBICube', this.getAllPSSysBICubes(), objKey) as IPSSysBICube;
  }

  protected allpssysbidimensions: IPSSysBIDimension[] | null = null;

  getAllPSSysBIDimensions(): IPSSysBIDimension[] | null {
    if (this.allpssysbidimensions == null) {
      this.allpssysbidimensions = this.fillChildListModel(this.M.getAllPSSysBIDimensions, 'bi.IPSSysBIDimension') as IPSSysBIDimension[];
    }
    return this.allpssysbidimensions;
  }

  get allPSSysBIDimensions(): IPSSysBIDimension[] | null {
    return this.getAllPSSysBIDimensions();
  }

  findPSSysBIDimension(objKey: any): IPSSysBIDimension | null {
    return this.getPSModel5('bi.IPSSysBIDimension', this.getAllPSSysBIDimensions(), objKey) as IPSSysBIDimension;
  }

  get bIEngineType(): 'KYLIN' | 'OLAP' | 'DB' | 'USER' | 'USER2' {
    return this.M.bIEngineType;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected pssyssfplugin: IPSSysSFPlugin | null = null;

  getPSSysSFPlugin(): IPSSysSFPlugin | null {
    if (this.pssyssfplugin != null) return this.pssyssfplugin;
    const value = this.M.getPSSysSFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyssfplugin = this.getPSModel4('res.IPSSysSFPlugin', value, 'getPSSysSFPlugin') as IPSSysSFPlugin;
    return this.pssyssfplugin;
  }

  get psSysSFPlugin(): IPSSysSFPlugin | null {
    return this.getPSSysSFPlugin();
  }

  getPSSysSFPluginMust(): IPSSysSFPlugin {
    const value = this.getPSSysSFPlugin();
    if (value == null) {
      throw new Error('未指定后台扩展插件');
    }
    return value;
  }

  protected pssystemmodule: IPSSystemModule | null = null;

  getPSSystemModule(): IPSSystemModule | null {
    if (this.pssystemmodule != null) return this.pssystemmodule;
    const value = this.M.getPSSystemModule;
    if (value == null) {
      return null;
    }
    this.pssystemmodule = this.getPSModel4('system.IPSSystemModule', value, 'getPSSystemModule') as IPSSystemModule;
    return this.pssystemmodule;
  }

  get psSystemModule(): IPSSystemModule | null {
    return this.getPSSystemModule();
  }

  getPSSystemModuleMust(): IPSSystemModule {
    const value = this.getPSSystemModule();
    if (value == null) {
      throw new Error('未指定系统模块');
    }
    return value;
  }

  get schemeTag(): string {
    return this.M.schemeTag;
  }

  get schemeTag2(): string {
    return this.M.schemeTag2;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSSysBISchemeImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelObject' || cls == 'IPSObject' || cls == 'bi.IPSBIScheme' || cls == 'bi.IPSSysBIScheme') return true;
    return super.instanceof(cls);
  }
}
